<template>
	<view class="content">
		<SideEdge :Dataindex='4'></SideEdge>
		<view class="right">
			<web-view style="position: absolute !important; left: 300px;" :src="albus_token" class="webview"
				:fullscreen="false" :webview-styles="webviewStyles"></web-view>
		</view>
	</view>
</template>

<script>
	import {
		memberInfo
	} from '@/common/api/user.js'
	export default {
		data() {
			return {
				albus_token: null,
				webviewStyles: {
					// progress: {
					// 	color: "#FF3333"
					// }
				}
			}
		},
		onLoad() {
			plus.key.addEventListener('backbutton', this.backButtonListener, false);
		},
		methods: {
			backButtonListener() {
				const currentWebview = plus.webview.currentWebview();
				currentWebview.canBack((e) => {
					console.log(e)
					if (e.canBack) {
						// WebView可以返回，触发WebView的返回
						currentWebview.back();
					} else {
						// WebView不能返回，触发App的返回
						plus.key.removeEventListener('backbutton', this.backButtonListener, false);
						uni.switchTab({
							url:'/pages/index/main'
						})
					}
				});
			}
		},
		onShow() {
			uni.hideTabBar()
			plus.key.addEventListener('backbutton', this.backButtonListener, false);
			memberInfo().then(res => {
				this.albus_token = 'http://bus.wilmer.com.cn/loginOther?token=' + res.data.albus_token
			})
		}
	}
</script>

<style>
	page {
		width: 100%;
		height: auto;
		background: #F7F7F7;
		overflow-x: hidden;
	}
</style>

<style lang="scss" scoped>
	.content {
		width: 100vw;
		height: 100vh;
		display: flex;
		align-items: center;
		position: relative;
	}

	.right {
		width: calc(100vw - 300px);
		height: 100vh;

		.webview {
			position: absolute !important;
			left: 300px !important;
		}
	}
</style>